import React, {useContext} from 'react'
import { Context } from './useReducer'
export let Test = () => {
    const [items,dispatch] = useContext(Context)
    return(
        <ul>
                {items.map((item,index) => (
                    <li className="section" key={item.id}>{item.name}
                        <button className="button" onClick={() => dispatch({type:'remove',index})}>X</button>
                    </li>
                ))}
            </ul>
    )
}